package com.mo;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
public class NacosProviderApplication {

    public static void main(String[] args) {
        SpringApplication.run(NacosProviderApplication.class, args);
    }

    //注解用于告诉spring，从application.yml配置文件中取出对应的属性值
    @Value("${server.port}")
    private String server;

    @RestController
    public class ProviderController {

            @GetMapping(value = "/provider/echo/{string}")
            public String echo(@PathVariable String string) {//回旋方法
                return "nacos-provider"+server + "say:Hello Nacos Discovery " + string;
            }

        }
    }
